home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-12-08 | 39.8 KB | 1,154 lines | [TEXT/R*ch] |
- C.S.M.P. Digest Fri, 25 Dec 92 Volume 1 : Issue 227
-
- Today's Topics:
-
- Claris Apple Events
- 64-bit multiply and divide on 68000
- Time Manager Sample Code...
- How to call FORTRAN subroutines from Excel (Summary)
- best way to pause in app ?
- Simulating odoc event from THINK Pascal?
- Whip me, beat me, what to do with DISCIPLINE?
-
-
-
- The Comp.Sys.Mac.Programmer Digest is moderated by Michael A. Kelly.
-
- The digest is a collection of article threads from the internet newsgroup
- comp.sys.mac.programmer. It is designed for people who read c.s.m.p. semi-
- regularly and want an archive of the discussions. If you don't know what a
- newsgroup is, you probably don't have access to it. Ask your systems
- administrator(s) for details. If you don't have access to news, there is
- no way that I know of for you to post articles to the group.
-
- Each issue of the digest contains one or more sets of articles (called
- threads), with each set corresponding to a 'discussion' of a particular
- subject. The articles are not edited; all articles included in this digest
- are in their original posted form (as received by our news server at
- cs.uoregon.edu). Article threads are not added to the digest until the last
- article added to the thread is at least one month old (this is to ensure that
- the thread is dead before adding it to the digest). Article threads that
- consist of only one message are generally not included in the digest.
-
- The entire digest is available for anonymous ftp from ftp.cs.uoregon.edu
- [128.223.8.8] in the directory /pub/mac/csmp-digest. Be sure to read the
- file /pub/mac/csmp-digest/README before downloading any files. The most
- recent issues are available from sumex-aim.stanford.edu [36.44.0.6] in the
- directory /info-mac/digest/csmp. If you don't have ftp capability, the sumex
- archive has a mail server; send a message with the text '$MACarch help' (no
- quotes) to LISTSERV@ricevm1.rice.edu for more information.
-
- The digest is also available via email. Just send a note saying that you
- want to be on the digest mailing list to mkelly@cs.uoregon.edu, and you will
- automatically receive each new issue as it is created. Sorry, back issues
- are not available through the mailing list.
-
- Send administrative mail to mkelly@cs.uoregon.edu.
-
-
- -------------------------------------------------------
-
- From: dawson@cs.cornell.edu (Dawson Dean)
- Subject: Claris Apple Events
- Date: 19 Nov 92 03:06:57 GMT
- Organization: Cornell Univ. CS Dept, Ithaca NY 14853
-
-
- I want to send an apple event to several third party programs,
- particularly some of Claris' programs (MacWrite, FileMaker, etc.).
- I looked through the Apple Events Doirectory on ftp.apple.com,
- but all that lists is the core events and the QuickDraw events.
-
- Does Claris publicize these things? I`ve seen demos where their
- programs work closely together, so there is an extensive set of
- Apple Events, but do they tell developers about these?
-
- Does anybody at Claris read this group? How about it? Is there
- something like a claris ftp site (my local yp has no idea of
- claris.com). Is there an 800 number?
-
- How about becoming a registered Claris-cadet-developer-scout?
- Is there some contact that tells me about this? I remember when
- the MacWrite/Draw TN's went over to Claris (#15 and 16 if I
- remember correctly) and there was some note about calling Claris'
- own developer support or something. Does this exist?
-
- Does Apple release this kind of stuff about 3rd party apps?
-
- Any information would be a great help,
- Thanks mucho,
-
- Dawson Dean
- dawson@cs.cornell.edu
- - --
- __________________________________________________________________
- Dawson Dean Internet: dawson@cs.cornell.edu
- Cornell Computer Science Office: (607) 255-1068
- __________________________________________________________________
-
- +++++++++++++++++++++++++++
-
- From: lai@Apple.COM (Ed Lai)
- Date: 20 Nov 92 17:42:11 GMT
- Organization: Apple Computer Inc., Cupertino, CA
-
- In article <1992Nov19.030657.9662@cs.cornell.edu> dawson@cs.cornell.edu (Dawson Dean) writes:
- >
- > I want to send an apple event to several third party programs,
- >particularly some of Claris' programs (MacWrite, FileMaker, etc.).
- >I looked through the Apple Events Doirectory on ftp.apple.com,
- >but all that lists is the core events and the QuickDraw events.
- >
- >Does Claris publicize these things? I`ve seen demos where their
- >programs work closely together, so there is an extensive set of
- >Apple Events, but do they tell developers about these?
- >
-
- In general applications that supports Apple Events would publish the
- event they supported in an aete resource. A number of scripting system
- would parse the aete resource to use the information. Look in ftp.apple.com in
- /pub/appleevents for ResEdit template for the aete resource (only work
- if the resource is small), HyperCard aete editor stack to read the aete
- resource, and Apple Event XCMD stack to talk from HyperCard to such
- application using the aete information.
-
- /* Disclaimer: All statments and opinions expressed are my own */
- /* Edmund K. Lai */
- /* Apple Computer, MS37-UP */
- /* 20525 Mariani Ave, */
- /* Cupertino, CA 95014 */
- /* (408)974-6272 */
- zW@h9cOi
-
-
- +++++++++++++++++++++++++++
-
- From: jpugh@apple.com (Jon Pugh)
- Date: Sat, 21 Nov 1992 06:30:25 GMT
- Organization: Apple Computer, Inc.
-
- In article <1992Nov19.030657.9662@cs.cornell.edu>, dawson@cs.cornell.edu
- (Dawson Dean) wrote:
- >
- > I want to send an apple event to several third party programs,
- > particularly some of Claris' programs (MacWrite, FileMaker, etc.).
- > I looked through the Apple Events Doirectory on ftp.apple.com,
- > but all that lists is the core events and the QuickDraw events.
- >
- > Does Claris publicize these things? I`ve seen demos where their
- > programs work closely together, so there is an extensive set of
- > Apple Events, but do they tell developers about these?
-
- FileMaker Pro is the only Claris app that supports the object model and
- Apple Events. Hypercard supports only a few Apple Events.
-
- Jon
-
- ---------------------------
-
- From: squeegee@world.std.com (Stephen C. Gilardi)
- Subject: 64-bit multiply and divide on 68000
- Organization: SQ Software via The World Public Access UNIX, Brookline, MA
- Date: Sat, 21 Nov 1992 23:51:42 GMT
-
- I need to calculate a linear interpolation rapidly. The equation is
-
- y = x * numer / denom,
-
- where y, numer, and denom are 32-bit unsigned longs and x is a 16-bit
- unsigned short.
-
- On the 68020, I can use the built-in "long" multiply and divide instructions.
- However on the 68000 it's more involved.
-
- I found 68000 code in a book to do the 64-bit unsigned multiply. I'd
- like to have the divide in assembly language as well.
-
- Does anyone have such a routine, or a reference to where I can find one?
-
- Thanks,
- - --Steve
-
- Stephen C. Gilardi
- SQ Software
- squeegee@world.std.com
-
-
- +++++++++++++++++++++++++++
-
- From: jmunkki@vipunen.hut.fi (Juri Munkki)
- Organization: Helsinki University of Technology
- Date: Sun, 22 Nov 1992 10:51:22 GMT
-
- In article <By3BM7.InD@world.std.com> squeegee@world.std.com (Stephen C. Gilardi) writes:
- >I need to calculate a linear interpolation rapidly. The equation is
- >
- > y = x * numer / denom,
- >
- >where y, numer, and denom are 32-bit unsigned longs and x is a 16-bit
- >unsigned short.
- >
- >On the 68020, I can use the built-in "long" multiply and divide instructions.
- >However on the 68000 it's more involved.
- >
- >I found 68000 code in a book to do the 64-bit unsigned multiply. I'd
- >like to have the divide in assembly language as well.
- >
- >Does anyone have such a routine, or a reference to where I can find one?
-
- I'm also interested in a good division routine for the 68K. Here's a routine
- that does essentially what you wanted to do and a bit more. It uses 32 bit
- fixed point numbers. I would very much like to see an improved division
- routine. I wasn't able to figure out anything better on my own and since
- my main target processor is the 68030, this version is not used all that
- often.
-
- Since your x is a short, you will save quite a bit of time by using that
- knowledge to optimize the code.
-
- Fixed FMulDiv68000(a,b,c)
- Fixed a,b,c;
- {
- asm {
- movem.l D3-D5,-(sp)
- move.l a,D0
- bpl.s @positive_a
- neg.l c
- neg.l D0
- @positive_a
- move.l b,D1
- bpl.s @positive_b
- neg.l D1
- neg.l c
- @positive_b
- move.w D1,D2
- mulu.w D0,D2 ; D2 = Lo * Lo
-
- move.w D1,D3
- swap D0
- mulu.w D0,D3 ; D3 = Hi * Lo
-
- swap D1
- move.w D1,D4
- mulu.w D0,D4 ; D4 = Hi * Hi
-
- swap D0
- mulu.w D0,D1 ; D1 = Lo * Hi
-
- clr.l D5
- move.w D3,D5
- swap D5
- clr.w D3
- swap D3
- add.l D5,D2 ; 64 bit addition Hi*Hi:Lo*Lo += Hi*Lo
- addx.l D3,D4
-
- clr.l D5
- move.w D1,D5
- swap D5
- clr.w D1
- swap D1
- add.l D5,D2 ; 64 bit addition Hi*Hi:Lo*Lo+Hi*Lo += Lo*Hi
- addx.l D1,D4 ; Result is now in D4:D2
-
- add.l D2,D2
- addx.l D4,D4
-
- move.l c,D1
- bpl.s @positive_c
- neg.l D1
- @positive_c
- moveq.l #1,D0
- bra.s @divloop
- @divok
- lsl.l #1,D0
- bcs.s @divdone
- add.l D2,D2
- addx.l D4,D4
- @divloop
- sub.l D1,D4
- bcc.s @divok
-
- addx.l D0,D0
- bcs.s @divdone
-
- add.l D1,D4
- add.l D2,D2
- addx.l D4,D4
- bra.s @divloop
-
- @divdone
- move.l c,D1
- bpl.s @positive_result
-
- addq.l #1,D0
- bra.s @done
- @positive_result
- eor.l #-1,D0
- @done
- movem.l (sp)+,D3-D5
- }
- }
-
-
- - --
- Juri Munkki Windsurf: fast sailing
- jmunkki@hut.fi Macintosh: fast software
-
- ---------------------------
-
- From: urritche@mcs.drexel.edu (Ralph Paul Ritchey)
- Subject: Time Manager Sample Code...
- Date: 20 Nov 92 17:21:11 GMT
- Organization: Drexel University
-
- Netters:
-
- Does anyone know of any code floating around that I can get my
- hands on that uses the Time Manager? I've poked around but haven't turned
- anything up yet.... Thanks in advance!
-
- Ralph Ritchey
- urritche@mcs.drexel.edu
- @king.mcs.drexel.edu
-
- +++++++++++++++++++++++++++
-
- From: mac@coos.dartmouth.edu (Milton A. Colvin)
- Date: 22 Nov 92 22:25:18 GMT
- Organization: Dartmouth College, Hanover, NH
-
- urritche@mcs.drexel.edu (Ralph Paul Ritchey) writes:
-
-
- > Does anyone know of any code floating around that I can get my
- >hands on that uses the Time Manager? I've poked around but haven't turned
- >anything up yet.... Thanks in advance!
-
-
-
- Is MPW C++ OK?
-
- FILE Ticker.h
- //----------------------------------------------------------------------------------------
- // Included files:
- //----------------------------------------------------------------------------------------
- #include <Types.h>
- #include <Timer.h> // toolbox timer manager
-
- //========================================================================================
- // class CTicker
- //========================================================================================
- // implement a cyclic subroutine called every (usec) 5sec.
- // this typically triggers some event or resets something
- // the subroutine is called as a timer task
- // it must be memory resident
- // it cannot reference globals
- // it cannot call the OS
- //
- class CTicker : public TMTask
- {
- public:
- CTicker(long usec) : fInterval(-usec),fCount(0) { } // create inactive ticker
- ~CTicker() { Off(); } // inactivate & destroy
-
- void On(); // start ticking
- void Off(); // stop
- Boolean Busy(); // determine whether running
-
- virtual void Tick(); // tick went off
- long Elapsed(); // elapsed time in usec
-
- long fCount; // incremented
-
- protected:
- QElemPtr Task(); // timer queue entry
- static pascal void Ticked(); // handle & forward call
-
- long fInterval; // -usec intervals
- };
-
- //========================================================================================
- // class CTicker
- //========================================================================================
- // run a precise timer
- // this timer measures the time from OnIOff
- // Once Off the elapsed time is available.
- // the timer is reset by reuse
-
- class CTimer : public TMTask
- {
- public:
- CTimer() { } // create inactive timer
- ~CTimer() { Off(); } // inactivate & destroy timer
-
- void On(); // start running
- void Off(); // stop
- Boolean Busy(); // determine whether running
- long Elapsed(); // elapsed time in usec
-
- protected:
- QElemPtr Task(); // timer queue entry
- };
-
-
- FILE Ticker.cp
-
- // implement various kinds of clock
- #include "Ticker.h"
- #include <Types.h>
- #include <Timer.h> // toolbox timer manager
- #include <Limits.h> // big numbers for times
-
- #pragma segment Main // some of this must be memory-resident
-
- //========================================================================================
- // class CTicker
- //========================================================================================
-
- // a timer task handler is called with the task pointer in A1
-
- static void *GetA1() = 0x2009; // MOVE.L A1,D0
-
- //----------------------------------------------------------------------------------------
- // pass to OS as timer queue entry
- inline QElemPtr CTicker::Task() { return (QElemPtr)this; }
-
- //----------------------------------------------------------------------------------------
- // to enable the ticker fill in the timer task and prime it
- void
- CTicker::On()
- { qLink = NULL;
- qType = 0;
- tmCount = tmWakeUp = tmReserved = 0;
- tmAddr = Ticked; // our handler
- InsXTime(Task());
- PrimeTime(Task(),fInterval);
- }
-
- //----------------------------------------------------------------------------------------
- // remove ticker from active timer queue
- //
- void CTicker::Off() { RmvTime(Task()); }
-
- // i think this is true
- Boolean CTicker::Busy() { return qLink!=NULL; }
-
- //----------------------------------------------------------------------------------------
- // when called we set up the this pointer
- // incrment the counter and forward the call
- //
- pascal void
- CTicker::Ticked()
- { CTicker &me = *(CTicker*)GetA1(); // this in A1
- PrimeTime(me.Task(),me.fInterval); // reschedule
- me.fCount++; // just for good measure
- me.Tick(); // pass control
- }
-
- //----------------------------------------------------------------------------------------
- //
- long CTicker::Elapsed() { return fCount*-fInterval; }
-
- //----------------------------------------------------------------------------------------
- // the default handler does nothing
- //
- void CTicker::Tick() { }
-
-
- //========================================================================================
- // class CTimer
- //========================================================================================
-
- // this limits the maximum duration we can measure
- // if we really wanted to be good,
- // we could handle the expiration and restart the timer
-
- const long kMaxTime = INT_MAX; // set a timer for as long as possible
-
- //----------------------------------------------------------------------------------------
- // pass to OS as timer queue entry
- //
- inline QElemPtr CTimer::Task() { return (QElemPtr)this; }
-
- //----------------------------------------------------------------------------------------
- // fill in the timer task and prime it
- //
- void
- CTimer::On()
- { qLink = NULL;
- qType = 0;
- tmCount = tmWakeUp = tmReserved = 0;
- tmAddr = NULL; // no handler
- InsXTime(Task());
- PrimeTime(Task(),-kMaxTime);
- }
-
- //----------------------------------------------------------------------------------------
- //
- void CTimer::Off() { RmvTime(Task()); }
-
- //----------------------------------------------------------------------------------------
- //
- long CTimer::Elapsed() { return tmCount-kMaxTime; }
-
- ---------------------------
-
- From: garrett@me.udel.edu (Joel J. Garrett; Office 127 CMSL; Phone 831-2332)
- Subject: How to call FORTRAN subroutines from Excel (Summary)
- Date: 19 Nov 92 15:14:26 GMT
- Organization: University of Delaware
-
- First of all, I'd like to thank the following for their replies and
- information:
-
- Scott D. Stecker <stecker@ecn.purdue.edu>
- Michael Alan Roberts <roberts@ucunix.san.uc.EDU>
- David M. Palmer <palmer@alumni.cco.caltech.edu>
- Brion Sarachan <sarachan@wsqtbf.crd.ge.com>
- Andy Ralston <aralston@janus.ece.wisc.edu>
- David C. Doherty <doherty@msc.edu>
- Joel Spolsky <joelsp@microsoft.com>
-
- And now here's the question I asked once again for those who may have
- missed my original posting:
-
- >How difficult would it be to interface a set of existing FORTRAN
- >subroutines to an Excel Spreadsheet? Is it possible to somehow include
- >a compiled set of subroutines and/or functions in an Excel spreadsheet
- >or add-in that could be called using the regular
- >'=function(arg1,arg2,arg3,...)' convention. I think that I recall
- >reading something about being able to call code in DLLs from the
- >Windows version of Excel (and the MS Fortran compiler now can produce
- >DLLs, right?), but I mainly need to be able to do this using a
- >Macintosh-based FORTRAN compiler and Excel. The reference section of
- >the Excel manuals lists a few hooks that are supposed to be used for
- >external functions, but they really don't give any examples or the
- >like, at least not as far as I can see.
-
- >Suggestions regarding which FORTRAN compiler would work best for this
- >(on either platform, Windows or Mac) and how to actually pull it off
- >(if it is even possible) would be greatly appreciated. Examples of how
- >to do this in Think C or Borland C++ would be helpful if it would be
- >possible to extrapolate these into Fortran solutions.
-
- The general consensus seems to be that documentation for being able to do this
- kind of thing has been quite scarce in the past. However, the Microsoft Press
- has just recently published a book which goes into this subject in detail. The
- "Excel Software Developer's Kit" (ISBN # 1-55615-521-2, $49.95 suggested
- retail price) gives examples of how to write external functions for Excel
- using the C programming language. (I am assuming that the book covers such
- development on _both_ the Mac & PC platforms, but I haven't gotten the book
- yet, so "caveat emptor")
-
- Ok, so this isn't FORTRAN, but it shouldn't be too much of a stretch to
- extrapolate the FORTRAN solution from some C examples, and if push comes to
- shove I have access to Think C so we could always code with that if the
- FORTRAN solution doesn't work out.
-
- So, technically, the jury is still out on how difficult calling FORTRAN
- subroutines from Excel will be. Once I get the book and do some work it
- should be pretty clear how well this kind of thing works. Anyone
- interested in the outcome of this experiment should send me email and I'll
- let you all know how things turn out in the end.
-
- The main consensus on which FORTRAN compiler to use on the Mac was the product
- from Language Systems, which wasn't a big surprise - I had already read the
- report on Macintosh Fortran compilers in the sumex Info-Mac archives
- (/info-mac/reports/fortran-compilers.txt at sumex-aim.stanford.edu)
-
- I also learned about the "Excel Developers' Forum" mailing list
- (clay=xldev@microsoft.COM), which will also prove to be a useful resource for
- information exchange as we get more into Excel software development. Does
- anyone know the registration address for this mailing list so that I can
- officially join the list?
-
- Thanks again to those who took the time to respond!
-
- Joel Garrett
- (garrett@me.udel.edu)
-
- +++++++++++++++++++++++++++
-
- From: (Tim Keitt)
- Date: Fri, 20 Nov 92 17:56:53 GMT
- Organization: University of New Mexico, Albuquerque NM
-
- In article <BxyyC2.41D@news.udel.edu> garrett@me.udel.edu (Joel J. Garrett; Office 127 CMSL; Phone 831-2332) writes:
- >First of all, I'd like to thank the following for their replies and
- >information:
- >
- >Scott D. Stecker <stecker@ecn.purdue.edu>
- >Michael Alan Roberts <roberts@ucunix.san.uc.EDU>
- >David M. Palmer <palmer@alumni.cco.caltech.edu>
- >Brion Sarachan <sarachan@wsqtbf.crd.ge.com>
- >Andy Ralston <aralston@janus.ece.wisc.edu>
- >David C. Doherty <doherty@msc.edu>
- >Joel Spolsky <joelsp@microsoft.com>
- >
- >>How difficult would it be to interface a set of existing FORTRAN
- >>subroutines to an Excel Spreadsheet? Is it possible to somehow include
- >
- > stuff deleted...
- >
- >Thanks again to those who took the time to respond!
- >
- >Joel Garrett
- >(garrett@me.udel.edu)
-
- I just thought I'd mention that I recently hear that MS is
- building a callable interface to Excel. When that's available,
- you'll be able to call *excel* from within your program (I
- suppose this may be at the DLL level, but I'm not sure). This
- is a great idea, someone could for instance create a full blown
- stats package that used calls to excel for its interface and
- display output. It would be like an excel add-in, only much
- faster and with smoother integration. All of excels built in
- functions would I presume be available as function calls. This
- could save a lot of coding effort.
-
- - --
- Timothy Keitt
- tkeitt@algodones.unm.edu
-
-
-
-
- +++++++++++++++++++++++++++
-
- From: joelsp@microsoft.com (Joel Spolsky)
- Date: 22 Nov 92 05:33:09 GMT
- Organization: Microsoft Corporation
-
- In article <5mnq6n-@lynx.unm.edu> tkeitt@algodones.unm.edu writes:
- >
- >I just thought I'd mention that I recently heard that MS is
- >building a callable interface to Excel.
- > ...
-
- It's done. All you need is the Excel Software Development Kit (ISBN
- 1-55615-521-2; Microsoft Press; $49.95; to order call 1-800-MSPRESS)
- and Excel 4.0 or later. You can create code resources (on the Mac) or
- DLLs (on Windows) that call Excel and use Excel's functionality.
-
- - --
- Joel Spolsky
- Program Manager
- Microsoft Excel
- joelsp@microsoft.com
-
-
-
- ---------------------------
-
- From: brownlow@informix.com (Keith Brownlow)
- Subject: best way to pause in app ?
- Date: 20 Nov 92 00:27:18 GMT
- Organization: Informix Software, Inc.
-
- Is there a toolbox command to make the application wait x number of seconds
- before continuing processing ? I've tried looping for 1000's of seconds but
- without doing anything in the loop, it's more or less instantly coming back.
-
- Anyone got a simple solution that I've missed in my manuals ?
- - --
- - -------------------------------------------------------------------------------
- |brownlow@informix.com "Intense !" |
- |brownlow@wet.com "A repo man's always intense !" |
- - -------------------------------------------------------------------------------
-
- +++++++++++++++++++++++++++
-
- From: fixer@faxcsl.dcrt.nih.gov (Chris Spiral Catfish Tate)
- Organization: Computer Systems Laboratory, DCRT, NIH
- Date: Fri, 20 Nov 1992 13:53:48 GMT
-
- In article <brownlow.722219238@stmartin>, brownlow@informix.com (Keith Brownlow) writes:
- >Is there a toolbox command to make the application wait x number of seconds
- >before continuing processing ? I've tried looping for 1000's of seconds but
- >without doing anything in the loop, it's more or less instantly coming back.
-
- Several things you can use (code given in C):
-
- 1) You could use Delay(60L * num_of_seconds, &dummy_long);
-
- This is okay, except that it pretty much freezes the machine until the
- delay is over, i.e. no background processing.
-
- 2) You could call WaitNextEvent(0, &dummy_event, 60L * num_of_seconds, 0L);
-
- This would give time to other processes, but would not necessarily give
- them the full time you specify. If you're the only process running, for
- example, you would return immediately.
-
- 3) Combination approach:
-
- long timeNow;
-
- timeNow = TickCount();
- while (TickCount() - timeNow < 60L * num_of_seconds)
- {
- (void) WaitNextEvent(0, &dummyEvent, 0L, 0L);
- }
-
- This repeatedly gives time to other processes until the specified amount
- of time has elapsed, at which point you drop out of the while loop.
-
- Calling Delay() for long periods of time (i.e. seconds) is pretty anti-
- social to other processes; I'd probably use approach 3) if I were going to
- be pausing for more than about a second. The one caveat is that you *might*
- not get control back for a much longer time, if another process is trying to
- hog the machine by not calling WaitNextEvent().
-
- - ------------------------------------------------------------------------------
- Christopher Tate | The Leadfoot Collection, Continued:
- Management System Designers | * Heavy Fuel (Dire Straits)
- | * Last Scene in September (Preston Reed)
- fixer@faxcsl.dcrt.nih.gov | Because driving fast is a cathartic experience.
-
- +++++++++++++++++++++++++++
-
- From: weiser@pogo.den.mmc.com (Matt Weiser)
- Organization: Martin Marietta WIS
- Date: Fri, 20 Nov 1992 16:42:09 GMT
-
- In article <brownlow.722219238@stmartin>, brownlow@informix.com (Keith Brownlow) writes:
- >
- > Is there a toolbox command to make the application wait x number of seconds
- > before continuing processing ? I've tried looping for 1000's of seconds but
- > without doing anything in the loop, it's more or less instantly coming back.
- >
- > Anyone got a simple solution that I've missed in my manuals ?
- > --
- > -------------------------------------------------------------------------------
- > |brownlow@informix.com "Intense !" |
- > |brownlow@wet.com "A repo man's always intense !" |
- > -------------------------------------------------------------------------------
-
- IM Vol II p.384:
-
- PROCEDURE Delay (numTicks: LONGINT; VAR finalTicks: LONGINT);
- Trap macro _Delay
- On entry A0: numTicks (long word)
- On exit D0: finalTicks (long word)
-
- Delay causes the system to wait for the number of ticks (sixtieths of a sec)
- specified by numTicks, and returns in finalTicks the total number of ticks
- from system startup to the end of the delay.
-
- Warning: Don't rely on the duration of the delay being exact; it will
- usually be accurate to within one tick, but may be off by more than that.
- <why is deleted because I don't think it matters in your case>
-
- Example:
- void wait( long numOfSecs )
- {
-
- long numTicks = numOfSecs * 60;
- long fianlTicks;
-
- Delay( numTicks, &finalTicks );
- }
-
- Matt Weiser
- weiser@pogo.den.mmc.com
-
- +++++++++++++++++++++++++++
-
- From: k044477@hobbes.kzoo.edu (Jamie R. McCarthy)
- Organization: Kalamazoo College
- Date: Fri, 20 Nov 1992 18:56:55 GMT
-
- weiser@pogo.den.mmc.com (Matt Weiser) writes:
- >brownlow@informix.com (Keith Brownlow) writes:
- >>
- >> Is there a toolbox command to make the application wait x number of seconds
- >> before continuing processing ?
- >
- >PROCEDURE Delay (numTicks: LONGINT; VAR finalTicks: LONGINT);
-
- Help stamp out _Delay!
-
- Or at least, stamp it out if there's a better way to do things. _Delay
- grabs the CPU and doesn't let any other app have any time. If you meet
- two conditions, you can be much friendlier: (1) your delay period is
- longer than two or three ticks, and (2) it's not absolutely 100%
- essential that you make it back right on time.
-
- If those conditions apply--and I think they will, because you implied
- you'll be waiting at least one second, and you're probably not writing
- for a hospital--try code like the following:
-
- void betterDelay(short nTicksToDelay)
- {
- long lastTick = TickCount();
- while (nTicksToDelay > 3) { // the lower this number, the friendlier
- // give time to other apps
- EventRecord myEventRec;
- Boolean needToHandleEvt;
- needToHandleEvt = WaitNextEvent(0, &myEventRec,
- Max(nTicksToDelay - 5, 0),
- NULL);
- nTicksToDelay -= TickCount() - lastTick;
- lastTick += nTicksToDelay;
- }
- while (TickCount()-lastTick < nTicksToDelay) {
- // wait in a tight, unfriendly loop
- }
- }
-
- I know some gurus will be able to improve on this. For example, if your
- app is getting update events and you're not responding to them, then
- no other app will get time anyway. Plus, it's not a good idea to lock
- out suspend/resume events, because if another process brings itself to
- the front, you'll be suspended without your knowledge. But if you don't
- have any update events pending when you call this, you stand a very good
- chance of being excellent to your fellow apps. And a good chance is
- better than none.
- - --
- Jamie McCarthy Internet: k044477@kzoo.edu AppleLink: j.mccarthy
- My contribution to urban blues...
-
- +++++++++++++++++++++++++++
-
- From: cklarson@tomatillo.engr.ucdavis.edu (Christopher Klaus Larson)
- Date: 23 Nov 92 19:05:59 GMT
- Organization: College of Engineering - University of California - Davis
-
- In article <brownlow.722219238@stmartin> brownlow@informix.com (Keith Brownlow) writes:
- >Is there a toolbox command to make the application wait x number of seconds
- >before continuing processing ? I've tried looping for 1000's of seconds but
- >without doing anything in the loop, it's more or less instantly coming back.
- >
- >Anyone got a simple solution that I've missed in my manuals ?
- >--
-
- Look into using the Delay() function. You need to specify the time to
- delay in Ticks (approx. 1/60 sec) but this should be just what the
- doctor ordered.
-
- - --Chris
- cklarson@taco.engr.ucdavis.edu
-
- ---------------------------
-
- From: goodill_eric@tandem.com (Eric Goodill)
- Subject: Simulating odoc event from THINK Pascal?
- Organization: Tandem Computers, Inc.
- Date: Fri, 20 Nov 1992 16:43:56 GMT
-
- Hi,
-
- Has anybody come up with a relatively easy way to simulate odoc events from
- within THINK Pascal so that I can use the source level debugger while
- debugging my Apple event handlers? As it stands, I've just been using
- Macsbug which works just fine but is a bit tedious.
-
- Cheers, Eric
- Eric Goodill, goodill_eric@tandem.com, Tandem Computers, Cupertino, Calif.
-
- +++++++++++++++++++++++++++
-
- From: jpugh@apple.com (Jon Pugh)
- Date: Sat, 21 Nov 1992 06:41:41 GMT
- Organization: Apple Computer, Inc.
-
- In article <goodill_eric-201192084213@ericg.cpd.tandem.com>,
- goodill_eric@tandem.com (Eric Goodill) wrote:
- >
- > Has anybody come up with a relatively easy way to simulate odoc events from
- > within THINK Pascal so that I can use the source level debugger while
- > debugging my Apple event handlers? As it stands, I've just been using
- > Macsbug which works just fine but is a bit tedious.
-
- Add a **** FREF to THINK Pascal's BNDL if it doesn't already have one. I
- forget if I added one myself or if it came with one. Rebuild your desktop
- if you do add it.
-
- Now you can drag and drop things onto THINK Pascal.
-
- Run your program. Drag something onto THINK Pascal. Your program will get
- the 'odoc' event. Debug as usual.
-
- Simple enough for you?
-
- Jon
-
- +++++++++++++++++++++++++++
-
- From: siegel@world.std.com (Rich Siegel)
- Organization: GCC Technologies
- Date: Sat, 21 Nov 1992 23:28:01 GMT
-
- In article <goodill_eric-201192084213@ericg.cpd.tandem.com> goodill_eric@tandem.com (Eric Goodill) writes:
- >
- >Has anybody come up with a relatively easy way to simulate odoc events from
- >within THINK Pascal so that I can use the source level debugger while
- >debugging my Apple event handlers? As it stands, I've just been using
- >Macsbug which works just fine but is a bit tedious.
-
- THINK Pascal will pass Apple Events on to the running program. The catch
- is that since THINK Pascal suspends the running program when you switch
- out, the Apple Event needs to come from another machine on the network,
- a background daemon-like program that sends them once in a while, or
- from the running program itself.
-
- R.
-
-
-
- - --
- - -----------------------------------------------------------------------
- Rich Siegel Internet: siegel@world.std.com
- Software Engineer & Toolsmith
- GCC Technologies
-
- +++++++++++++++++++++++++++
-
- From: potts@oit.itd.umich.edu (Paul Potts)
- Date: 23 Nov 1992 15:24:06 GMT
- Organization: Instructional Technology Laboratory, University of Michigan
-
- In article <By3AIq.Ht6@world.std.com> siegel@world.std.com (Rich Siegel) writes:
- >In article <goodill_eric-201192084213@ericg.cpd.tandem.com> goodill_eric@tandem.com (Eric Goodill) writes:
- >>
- >>Has anybody come up with a relatively easy way to simulate odoc events from
- >>within THINK Pascal so that I can use the source level debugger while
- >>debugging my Apple event handlers? As it stands, I've just been using
- >>Macsbug which works just fine but is a bit tedious.
- >
- >THINK Pascal will pass Apple Events on to the running program. The catch
- >is that since THINK Pascal suspends the running program when you switch
- >out, the Apple Event needs to come from another machine on the network,
- >a background daemon-like program that sends them once in a while, or
- >from the running program itself.
-
- A related note - when I was working on some AppleEvent code last year, I
- would use a Hypercard stack with the AE XCMDs to send events to my program,
- and leave my program running under the debugger (THINK C, not Pascal) with
- a breakpoint in my AE handlers. Both were running on the same machine - I
- would swap from the project running in the debugger to Hypercard, send the
- event, and then when it was received the debugger would stop at the breakpoint.
- This was a tremendous timesaver. I'm not sure if it is possible to do something
- like this in THINK Pascal, though.
-
- (Actually I did this on a 4-meg SE/30 with virtual memory set to 16 megs;
- performance wasn't really that bad, since the main swapping occurred only when
- I switched applications. At the time System 7 was pretty new, and I was
- amazed that this scheme actually worked!)
-
- - --
- Politics is crime pursued by other means.
- potts@oit.itd.umich.edu CI$ 71561,3362 (rarely)
-
- ---------------------------
-
- From: brunner@crchh447.bnr.ca (James Brunner)
- Subject: Whip me, beat me, what to do with DISCIPLINE?
- Date: 19 Nov 92 01:13:29 GMT
- Organization: Bell-Northern Research, Richardson, Tx
-
- Ahh, the title caught your eye!
-
- I'm trying to get discipline to work. I have figured out that macsbugs (which
- I've used quite a bit) must be in the system folder. I've put discipline in
- the extensions folder. And put the discipline startup file in the system
- folder.
-
- I've tried using the "lenient" settings file and the finder keeps trapping it!
- (As soon as I turn it on with macsbugs DSCA ON). (I'm glad I didn't try strict.)
-
- How do you use this? Is there a way that I can make it only trap on my
- program? Are there any real instructions? If so, are they on line somewhere
- where I can ftp them?
-
- Help. I got a strange bug and I'm hoping that this will help me to find it.
- - --
- - ---------------------------------------------------------------------------
- Jim Brunner - (brunner@bnr.ca)
- All opinions are my own and have nothing whatsoever to do with BNR, NT,
- NTI, Bell Canada, or any of the BCE corporations or affiliates.
-
- +++++++++++++++++++++++++++
-
- From: danwood@netcom.com (Daniel J Wood)
- Organization: Netcom - Online Communication Services (408 241-9760 guest)
- Date: Thu, 19 Nov 1992 17:31:57 GMT
-
- brunner@crchh447.bnr.ca (James Brunner) writes:
-
- >I'm trying to get discipline to work.
-
- Welcome to the club.
- >I've tried using the "lenient" settings file and the finder keeps trapping it!
- >(As soon as I turn it on with macsbugs DSCA ON).
-
- Try typing DSCA ON from *within your application* to prevent discipline from
- acting on the finder. Yes, Finder violates beaucoup of what discipline catches.
- I've managed to use Discipline this way with success!
-
-
- +++++++++++++++++++++++++++
-
- From: creiman@netcom.com
- Organization: Netcom - Online Communication Services (408 241-9760 guest)
- Date: Thu, 19 Nov 1992 18:05:31 GMT
-
- brunner@crchh447.bnr.ca (James Brunner) writes:
-
- >Ahh, the title caught your eye!
-
- Yes, it did. Nice work.
-
- >I'm trying to get discipline to work. I have figured out that macsbugs (which
- >I've used quite a bit) must be in the system folder. I've put discipline in
- >the extensions folder. And put the discipline startup file in the system
- >folder.
-
- You've already screwed up by assuming Disipline is worth using. In all my
- days, the only thing Disipline has taught me is that the Finder is using
- SetRect wrong. Zippity-do-da. But if you must plow ahead:
-
- 1) Don't use D. the way they tell you to. Instead, change its type to 'APPL'.
- Take it out of the system folder, you've probably got enough junk there
- anyway.
-
- 2) Reboot, so you don't have it installed. Now, just double click on the
- D. application. Make sure there is a startup file in the same directory
- as D. itself. D. will install (but not activate) itself. The nice
- part about this is you can just quit D. when your done.
-
- 3) Go into Macsbug at the appropriate time and do the 'DSC ON' stuff.
- If you want to get fancy, you can bracket the code you want to test
- with DebugStr's to activate and deactivate D.
-
- 4) Realize you've been wasting time. Go buy TMON Pro or Jasik's Debugger,
- since they both do a better job at discipline than Discipline. Or,
- try your app under EvenBetterBusErr, Xap handles, Blat, or heap
- scrambling. Unlike Discipline, these have all proven their worth.
- (Leaks is pretty good too).
-
- 5) Another good technique is to extend the Xap handles concept one
- step further. Xap handles only stuffs a block with junk after you
- free it up. This doesn't catch uninitialized data structures. You
- can modify your program's memory allocator to stuff new blocks with
- bus error values when first allocated. This usualy catches lots of
- bugs for me. I think Jasik's will do this for you.
-
- Sorry for rambling on. Debugging is something I do far too often, and
- simple techniques like EBBE, et al can save much gnashing of teeth in
- the long run.
-
- Chao,
-
- Charlie.
- - --
- Charlie Reiman
- creiman@netcom.com
-
- +++++++++++++++++++++++++++
-
- From: rla20@duts.ccc.amdahl.com (Roger Allen)
- Date: 20 Nov 92 19:43:17 GMT
- Organization: Amdahl Corporation, Sunnyvale CA
-
- In article <1992Nov19.180531.4442@netcom.com> creiman@netcom.com writes:
- > try your app under EvenBetterBusErr, Xap handles, Blat, or heap
- > scrambling. Unlike Discipline, these have all proven their worth.
- > (Leaks is pretty good too).
- >
- >Chao,
- >
- >Charlie.
-
- What are Xap and Blat? I haven't heard of these before.
-
- (BTW, I agree 1000% with Charlie on EBBE, hs and leaks)
-
- Thanks,
-
- Roger
-
- - --
- > Roger Allen | Opinions expressed by me do not <
- > Amdahl Computer Development | represent the opinions of Amdahl. <
- > rla20@cd.amdahl.com | <
-
- +++++++++++++++++++++++++++
-
- From: creiman@netcom.com
- Organization: Netcom - Online Communication Services (408 241-9760 guest)
- Date: Fri, 20 Nov 1992 22:55:17 GMT
-
- rla20@duts.ccc.amdahl.com (Roger Allen) writes:
-
- >In article <1992Nov19.180531.4442@netcom.com> creiman@netcom.com writes:
- >> try your app under EvenBetterBusErr, Xap handles, Blat, or heap
- >> scrambling. Unlike Discipline, these have all proven their worth.
- >> (Leaks is pretty good too).
- >>
- >>Chao,
- >>
- >>Charlie.
-
- >What are Xap and Blat? I haven't heard of these before.
-
- Xap clears handle and pointer blocks to bus error values when
- disposed. It's handy for catching references to freed structures.
- Unfortunately, it doesn't pre-clear freshly allocated blocks to bus
- error values; which is handy for catching improperly initialized
- structures. If you use private glue to call the system's memory
- manager, you can write these utilties into your app for development,
- then strip them out when release time comes around.
-
- Blat uses protected memory mode of the MMU to protect the low level
- vectors. Basiclly, a fool-proof EBBE. This power has a price: you
- can't use VM with it.
-
- Have fun,
-
- Charlie.
-
- - --
- Charlie Reiman
- creiman@netcom.com
-
- +++++++++++++++++++++++++++
-
- From: robichau@lambda.msfc.nasa.gov (Paul Robichaux)
- Organization: New Technology, Inc.
- Date: Mon, 23 Nov 1992 17:27:55 GMT
-
- In <1992Nov20.225517.15649@netcom.com> creiman@netcom.com writes:
- >Blat uses protected memory mode of the MMU to protect the low level
- >vectors. Basiclly, a fool-proof EBBE. This power has a price: you
- >can't use VM with it.
-
- Blat also doesn't run on some machines- the IIci and IIsi come to
- mind, but I'm not certain if that's an inclusive list or not.
- - --
- Paul Robichaux, KD4JZG | May explode if disposed of improperly.
- Mission Software Development Div. | Printed on recycled phosphors.
- New Technology, Inc. | ** PGP 2.0 key available on request **
-
- +++++++++++++++++++++++++++
-
- From: nagle@netcom.com (John Nagle)
- Date: 23 Nov 92 20:56:48 GMT
- Organization: Netcom - Online Communication Services (408 241-9760 guest)
-
- creiman@netcom.com writes:
- >You've already screwed up by assuming Disipline is worth using. In all my
- >days, the only thing Disipline has taught me is that the Finder is using
- >SetRect wrong.
-
- Yes, the Finder people really should fix that. Or is there some
- secret thing you can get the Window Manager to do with vacuous rectangles?
-
- John Nagle
-
- ---------------------------
-
- End of C.S.M.P. Digest
- **********************
-